//
//  DSSHCommunityVC.m
//  DSSH
//
//  Created by Fuhao on 16/4/13.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "DSSHCommunityVC.h"
#import "DSSHBuildVC.h"

#define LINE 0.5
#define BUTTONWIDTH (([UIScreen mainScreen].bounds.size.width -(titlearray.count )*2)/titlearray.count-1)
#define TABLEWIDTH ([UIScreen mainScreen].bounds.size.width - 20)


@interface DSSHCommunityVC ()

@end

@implementation DSSHCommunityVC

- (void)viewDidLoad {
    [super viewDidLoad];
        self.isSearchhid = YES;
    [self initDataS];
    [self Settingleftbutotn];
    
    
}
-(void)initDataS
{
    for (int i = 0 ; i < 3; i ++ ) {
        NSMutableArray *tmpnarray = [NSMutableArray array];
        
        for (int k =0; k < (i+1) *5; k++) {
            [tmpnarray addObject:[NSString stringWithFormat:@"第%d小区",k]];
        }
        [self.dataoftable addObject:tmpnarray];
    }

}
-(void)Settingleftbutotn
{
    //设置左边按钮显示的内容
    UIButton *leftbutton = [[UIButton alloc] init];
    [leftbutton setTitle:self.recodeStr forState:UIControlStateNormal];
    [leftbutton setImage:[UIImage imageNamed:@"fanhui"] forState:UIControlStateNormal];
    [leftbutton addTarget:self action:@selector(Hitleftbutton:) forControlEvents:UIControlEventTouchUpInside];
    [leftbutton sizeToFit];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftbutton];

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)Hitleftbutton:(UIButton *)button
{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark 代理实现
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *str = nil;
    
    if(tableView == self.tableView0){
        
        
        str   = self.dataoftable[0][indexPath.row];
        
        
    }
    if(tableView == self.tableView1){
        
        str   = self.dataoftable[1][indexPath.row];
    }
    if(tableView == self.tableView2){
        
        
        str   = self.dataoftable[2][indexPath.row];
    }
    
    
    [self initNextVC:str];
}
-(void) initNextVC:(NSString *)nextL
{
    
    DSSHBuildVC *nextVC = [[DSSHBuildVC alloc] init];
    
    NSString *letfT =  self.recodeStr == nil? @"" : [NSString stringWithFormat:@"%@>",self.recodeStr];
    
    nextVC.recodeStr = [letfT stringByAppendingString:nextL];
    
    
    
    [self.navigationController pushViewController:nextVC animated:YES];
    
    

}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
